//
//  FFRecvTotalHeadCell.m
//  LLWallet
//
//  Created by tt on 2020/12/23.
//

#import "FFRecvTotalHeadCell.h"

@implementation FFRecvTotalHeadModel

- (Class)cell {
    return FFRecvTotalHeadCell.class;
}

@end

@interface FFRecvTotalHeadCell ()

@property(nonatomic,strong) UIView *boxView;

@property(nonatomic,strong) UIView *contentBoxView;

@property(nonatomic,strong) UILabel *titleLbl;
@property(nonatomic,strong) UILabel *amountLbl;

@end

@implementation FFRecvTotalHeadCell

+ (CGSize)sizeForModel:(FFRecvTotalHeadModel *)model {
    return CGSizeMake(WKScreenWidth, 70.0f);
}

- (void)setupUI {
    [super setupUI];
    [self setBackgroundColor:[UIColor clearColor]];
    [self.contentView addSubview:self.boxView];
    [self.boxView addSubview:self.contentBoxView];
    
    [self.contentBoxView addSubview:self.titleLbl];
    [self.contentBoxView addSubview:self.amountLbl];

}

- (void)refresh:(FFRecvTotalHeadModel *)model {
    [super refresh:model];
    
    self.amountLbl.text = [NSString stringWithFormat:@"¥%@",model.amount];
    [self.amountLbl sizeToFit];
}

- (void)layoutSubviews {
    [super layoutSubviews];
    
    self.boxView.lim_left = 10.0f;
    self.boxView.lim_width = self.lim_width - self.boxView.lim_left*2.0f;
    self.boxView.lim_height = self.lim_height;
    
    self.contentBoxView.lim_top = 20.0f;
    self.contentBoxView.lim_width = self.boxView.lim_width;
    self.contentBoxView.lim_height = self.lim_height - self.contentBoxView.lim_top;
    
    self.titleLbl.lim_left = 15.0f;
    self.titleLbl.lim_centerY_parent = self.contentBoxView;
    
    self.amountLbl.lim_centerY_parent = self.contentBoxView;
    self.amountLbl.lim_left = self.contentBoxView.lim_width - self.amountLbl.lim_width - 15.0f;
}

- (UIView *)boxView {
    if(!_boxView) {
        _boxView = [[UIView alloc] init];
        _boxView.backgroundColor = [UIColor colorWithRed:240.0f/255.0f green:240.0f/255.0f blue:240.0f/255.0f alpha:1.0f];
        
    }
    return _boxView;
}

- (UIView *)contentBoxView {
    if(!_contentBoxView) {
        _contentBoxView = [[UIView alloc] init];
        _contentBoxView.backgroundColor = [UIColor whiteColor];
    }
    return _contentBoxView;
}


- (UILabel *)titleLbl {
    if(!_titleLbl) {
        _titleLbl = [[UILabel alloc] init];
        _titleLbl.font = [[WKApp shared].config appFontOfSize:15.0f];
        _titleLbl.text = LLang(@"收款总计：");
        _titleLbl.textColor = [UIColor colorWithRed:49.0f/255.0f green:49.0f/255.0f blue:49.0f/255.0f alpha:1.0f];
        [_titleLbl sizeToFit];
    }
    return _titleLbl;
}

- (UILabel *)amountLbl {
    if(!_amountLbl) {
        _amountLbl = [[UILabel alloc] init];
        _amountLbl.font = [[WKApp shared].config appFontOfSizeSemibold:16.0f];
        _amountLbl.textColor = [UIColor blackColor];
    }
    return _amountLbl;
}


@end
